package com.onesports.intelligent.k12.polarlight.controller.operation.order;

import com.onesports.framework.kit.common.valid.Json;
import com.onesports.intelligent.k12.polarlight.common.utils.ResultUtil;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.OrdersSettlementQueryDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.market.SettlementOrderSelectDTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.market.OrdersSettlementVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.market.SettlementOrderSelectVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.market.TotalDataVO;
import com.onesports.intelligent.k12.polarlight.service.order.OrdersSettlementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags = "运营端-财务管理-财务结算")
@RestController
@RequiredArgsConstructor
@RequestMapping(ApiPathConstants.OPERATION_ORDER_SETTLEMENT)
public class OrderSettlementController {

    private final OrdersSettlementService ordersSettlementService;


    @ApiOperation("查询可结算订单分页数据")
    @GetMapping("/query-settlement-order-page")
    public ResponseEntity<TotalDataVO<SettlementOrderSelectVO>> querySettlementOrderPage( SettlementOrderSelectDTO dto){

        return ResultUtil.success(ordersSettlementService.querySettlementOrderPage(dto));
    }

    @ApiOperation("财务结算分页数据")
    @GetMapping("/page")
    public ResponseEntity<TotalDataVO<OrdersSettlementVO>> page(OrdersSettlementQueryDTO dto){
        return ResultUtil.success(ordersSettlementService.selectPage(dto));
    }

    @ApiOperation("确认结算")
    @PostMapping("/settlement-order")
    public ResponseEntity settlementOrder(@RequestBody SettlementOrderSelectDTO dto){
        ordersSettlementService.settlementOrder(dto);
        return ResultUtil.success();
    }

}
